.section	.data
.global a
.type a,%object
.size a,4
a:
.word 1


.global b
.type b,%object
.size b,4
b:
.word 1

.section	.rodata
.global Top
.type Top,%object
.size Top,4
Top:
.word 100

str1:
.ascii "%d %d \0"
str2:
.ascii "%d \0"

.section .text

.global fib
.type fib,%function
fib:
push {lr}

ldr r2,_bridge@a,get memory address of a
ldr r2,[r2]
ldr r1, _bridge+4@b
ldr r1,[r1]
ldr r0, _bridge+8@str1
push {r1,r2}

bl printf @printf("%d %d ",b,a)
pop {r1,r2}
ldr r4, _bridge+16
ldr r4,[r4]
.l1:
add r3,r1,r2@c=a+b
mov r2,r1@b=a
mov r1,r3@a=c
ldr r0,_bridge+12@str2
push {r0,r1,r2,r3}
bl printf @printf("%d",b+a)
pop {r0,r1,r2,r3}
cmp r3,r4
blt .l1

pop {pc}

.global main
.type main,%function
main:
push { lr }
bl fib
mov r0,#0
pop {pc}

_bridge :
.word a
.word b
.word str1
.word str2
.word Top 
